package com.cj.allTest;

import com.google.common.collect.Lists;
import jdk.nashorn.internal.objects.annotations.Getter;
import jdk.nashorn.internal.objects.annotations.Setter;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.*;
import java.util.stream.Collectors;

/**
 * @author chan
 * @dateTime 2022/11/8  16:35:30
 */
public class TestOption {
    public static void main(String[] args) {
        Stu stu = new Stu();
        stu.setName("cjj");
        stu.setHobby(new Hobby(1, "soccer"));
        String s = Optional.ofNullable(stu).map(Stu::getHobby).map(Hobby::getName).orElse("");


        List<Integer> ids = Arrays.asList(1, 2, 3, 54, 3, 4, 3, 2, 3, 32, 2, 2, 32, 3, 2, 3);
        ids.stream().peek(item -> System.out.println("过滤前" + item))
                .distinct()
                .peek(item -> System.out.println("过滤后" + item))
                .collect(Collectors.toList());
//        System.out.println(s);
    }

}


class Stu {
    private String name;

    private Hobby hobby;

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public Hobby getHobby() {
        return hobby;
    }

    public void setHobby(Hobby hobby) {
        this.hobby = hobby;
    }

    public static void main(String[] args) throws ParseException {
        List<String> dates = Lists.newArrayList("2022/11/3",
                "2022/11/9",
                "2022/11/10",
                "2022/11/10",
                "2022/11/15",
                "2022/11/15",
                "2022/11/21",
                "2022/11/29",
                "2022/11/30",
                "2022/1/6",
                "2022/1/7",
                "2022/1/7",
                "2022/1/7",
                "2022/1/8",
                "2022/1/8",
                "2022/1/8",
                "2022/1/9",
                "2022/1/9",
                "2022/1/9",
                "2022/1/9",
                "2022/1/10",
                "2022/1/11",
                "2022/1/11",
                "2022/1/11",
                "2022/11/1",
                "2022/11/1",
                "2022/11/1",
                "2022/11/1",
                "2022/11/1",
                "2022/11/1",
                "2022/11/1",
                "2022/11/1",
                "2022/11/1",
                "2022/11/1",
                "2022/11/1",
                "2022/11/1",
                "2022/11/25",
                "2022/11/25",
                "2022/12/9",
                "2022/12/9",
                "2022/12/9",
                "2022/12/9",
                "2022/12/9",
                "2022/12/12",
                "2022/12/12");
        SimpleDateFormat sdf = new SimpleDateFormat("yyyy/MM/dd");
        for (String date : dates) {
            Date parse = sdf.parse(date);
            //System.out.println(parse.getTime());
        }

        String str = "123123";
        System.out.println(str.equals(null));

    }
}

class Hobby {
    private Integer id;

    private String name;

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public Hobby(Integer id, String name) {
        this.id = id;
        this.name = name;
    }
}
